package com.huluobo.h3kotlinproject.demo

import android.content.Context
import androidx.room.Room

/**
 *  Created by LC on 2023/10/19.
 */
class Utils {
    companion object {
        private lateinit var appDatabase: AppDataBase

        fun init(appContext: Context) {
            appDatabase = Room.databaseBuilder(appContext, AppDataBase::class.java, "shopping")
                .allowMainThreadQueries()//可以让数据库的查询永远处于主线程中
                .build()
        }

        fun getAppDatabase(): AppDataBase {
            return appDatabase
        }
    }
}